package com.koron.operation.dispatch.mapper;

import com.koron.operation.dispatch.bean.EquipmentHistoryBean;
import com.koron.operation.dispatch.bean.dto.HistoryListDto;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface EquipmentHistoryMapper {
    int deleteByPrimaryKey(String id);

    int insert(EquipmentHistoryBean record);

    int insertSelective(EquipmentHistoryBean record);

    EquipmentHistoryBean selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(EquipmentHistoryBean record);

    int updateByPrimaryKey(EquipmentHistoryBean record);

    //变更历史
    List<HistoryListDto> queryStatusHistoryList(HistoryListDto dto);

    //查询设备最新状态
    EquipmentHistoryBean queryMaxChangeIimeFirstByEquipmentId(@Param("equipmentId") String equipmentId);

    //状态录入列表
    List<HistoryListDto> queryStatusList(HistoryListDto dto);

    //查某个时间前 某类型的 的最新记录
    List<EquipmentHistoryBean> queryStatusListByMaxChangeTime(@Param("maxChangeTime") Date maxChangeTime, @Param("equipmentType") String equipmentType);

    //查指定时间范围记录
    List<EquipmentHistoryBean> queryAllByChangeTimeBetween(@Param("minChangeTime") Date minChangeTime, @Param("maxChangeTime") Date maxChangeTime);

    //查指定类型、指定时间范围记录
    List<EquipmentHistoryBean> queryAllByChangeTimeBetweenAndEquipmentType(@Param("minChangeTime") Date minChangeTime, @Param("maxChangeTime") Date maxChangeTime, @Param("equipmentType") String equipmentType);

    //最近某 状态的 完成时间；
    List<HistoryListDto> queryStatusListByBeforeStatus(HistoryListDto HistoryListDto);

    //根据设备类型年份查记录
    List<EquipmentHistoryBean> queryByEquipmentTypeAndYear(@Param("equipmentType") String equipmentType, @Param("year") Integer year);

//    //根据年份月份、类型 查出最后一条记录
//    List<EquipmentHistoryBean> queryByYearAndMonthAndTypeLastRe(@Param("year") Integer year, @Param("month") Integer month, @Param("type") String type);

    //根据年份月份、类型 查出最后一条记录
    List<EquipmentHistoryBean> queryByYearAndMonthAndTypeLastRe(@Param("begintime") Date begintime, @Param("type") String type);



}
